<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="email=no" name="format-detection"/>
    <meta content="telephone=no" name="format-detection" />
    <link href="__PUBLIC__/css/layout.css" type="text/css" rel="stylesheet" >
    <script src="__PUBLIC__/js/jquery-1.10.1.min.js"></script>
</head>
<body>
<div class="head">
    <div class="head-cont"> <a href="javascript:history.back();"><i class="icon-iconfont-fanhui1"></i></a><span class="head-tit">分类</span> </div>
</div>
<div class="cate-left">
    <div class="h45"></div>
    <ul class="cate-ul">
        <li id="departments"><a href="javascript:;">科室找药</a></li>
        <li id="body"><a href="javascript:;">部位找药</a></li>
        <li id="chronic"><a href="javascript:;">慢性病</a></li>
        <li id="family"><a href="javascript:;">家庭小药箱</a></li>
        <li id="child"><a href="javascript:;">儿童用药</a></li>
        <li id="old"><a href="javascript:;">老人用药</a></li>
        <li id="female"><a href="javascript:;">妇女用药</a></li>
        <li id="season"><a href="javascript:;">季节病</a></li>
    </ul>
</div>
<div class="cate-right">
    <div class="h45"></div>
    <div class="cate-con">
        <ul>
            <php>if($cate_type != 'departments' and $cate_type != 'body'){
                    foreach($cate_info['disease'] as $k=>$v){</php>
                        <li><a href="/search/{$v}">{$v}</a></li>
                        <php>}</php>
            <php>}else{</php>
                <php>foreach($cate_info[$cate_type] as $k=>$v){</php>
                <li><a href="/category/{$cate_type}/{$v}">{$v}</a></li>
                <php>}}</php>
        </ul>
    </div>
</div>


</body>
<script>
    $(function(){
        $('#{$cate_type}').addClass('select');

        $('.cate-ul li').on('click',function(){
            $(this).addClass('select').siblings().removeClass('select');
            var id = $(this).attr('id');
            var append_ul = $('.cate-right ul');
            //ajax请求，获取信息
            $.ajax({
                url:'/category/'+id+'?access=xhr',
                type:'get',
                dataType:'json',
                beforeSend:function(){
                    append_ul.empty().append('<li class="know-li" id="loading" style="text-align: center"><img src="__PUBLIC__/images/loading.gif">正在加载中.....</li>')
                },
                success:function(msg){
                    if(msg.code == 200){
                        var lis = '';
                        for(i = 0; i < msg.info.length; i++){
                            var info = msg.info[i];
                            if(id == 'departments' || id == 'body'){
                                lis += '<li><a href="/category/'+id+'?detail_cate='+ info +'">'+info+'</a></li>'
                            }else{
                                lis += '<li><a href="/search/'+info+'">'+info+'</a></li>'
                            }

                        }
                        append_ul.empty().append(lis);
                    }
                }
            });
        });
    })
</script>
</html>
